#include <mathematics/Rectangle.h>

namespace ne
{
    Rectangle::Rectangle(const Vector2 &v, const real w, const real h)
        : origin(v),
          width(w),
          height(h)
    {
    }

    Rectangle::Rectangle(const Rectangle &r)
        : origin(r.origin),
          width(r.width),
          height(r.height)
    {
    }

    Rectangle& Rectangle::operator = (const Rectangle &r)
    {
        origin = r.origin;
        width = r.width;
        height = r.height;
        return *this;
    }

    void Rectangle::redefine(const Vector2 &v, const real w, const real h)
    {
        origin = v;
        width = w;
        height = h;
    }

    void Rectangle::setCenter(const Vector2 &v)
    {
        origin = v - Vector2(width, height) * 0.5f;
    }

    Vector2 Rectangle::getCenter() const
    {
        return origin + Vector2(width, height) * 0.5f;
    }

    GeometryClass Rectangle::getClass() const
    {
        return GC_RECTANGLE;
    }

    Rectangle::~Rectangle()
    {
    }
}
